#ifndef ES_SOFT_IIC_H_
#define ES_SOFT_IIC_H_


#include "stm32f10x.h"


//软件IIC IO设置
#ifndef I2C_EE_GPIO
	#define I2C_EE_GPIO        GPIOB  
#endif

#ifndef I2C_EE_SCL
	#define I2C_EE_SCL         GPIO_Pin_6  
#endif

#ifndef I2C_EE_SDA
	#define I2C_EE_SDA         GPIO_Pin_7  
#endif  



//前向声明
void i2c_init(void);

u8 i2c_ReadReg(u8 slaveAddr,u8 addr);

u8 i2c_WriteReg8(u8 slaveAddr,u8 addr,u8 wData);
u8 i2c_WriteReg16(u8 slaveAddr,u8 addr,u8 wData1,u8 wData2);
u8 i2c_WriteReg32(u8 slaveAddr,u8 addr,u8 wData1,u8 wData2,u8 wData3,u8 wData4);








////////////////////////////////////////  defines  ////////////////////////////////////////////////////////////
 
#define i2c_dTime 5    
  
#define SCL_H         GPIOB->BSRR = I2C_EE_SCL  
#define SCL_L         GPIOB->BRR  = I2C_EE_SCL  
  
#define SDA_H         GPIOB->BSRR = I2C_EE_SDA  
#define SDA_L         GPIOB->BRR  = I2C_EE_SDA  
  
#define SCL_read      GPIOB->IDR  & I2C_EE_SCL  
#define SDA_read      GPIOB->IDR  & I2C_EE_SDA  





#endif
